package com.aaa.home.controller;

import com.aaa.common.vo.Result;
import com.aaa.home.service.TblZoneService;
import com.aaa.home.vo.ZoneAddVo;
import com.aaa.home.vo.ZoneVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：Mickey
 * @date ：Created in 2022/12/6 22:47
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/zone")
@Api(tags = "专区接口类")
public class TblZoneController {

    @Autowired
    private TblZoneService zoneService;

    //分页查询所有角色
    @PostMapping("/getAllZone/{current}/{pageSize}")
    public Result findRoleByPage(@RequestBody ZoneVo zoneVo,
                                 @PathVariable Integer current,
                                 @PathVariable Integer pageSize
    ){
        return zoneService.getAllZonePage(zoneVo,current,pageSize);
    }
    //改变专区状态
    @PostMapping("/changeStatus/{id}/{isDisable}")
    public Result updateZoneStatus(@PathVariable String id,
                                   @PathVariable Integer isDisable){

        return zoneService.updateZoneStatus(id,isDisable);
    }
    //删除专区
    @PostMapping("/deleteZone/{id}")
    public Result deleteZoneById(@PathVariable String id){
        System.out.println("删除专区"+id);
        return zoneService.deleteZoneBtId(id);
    }
    //添加专区
    @PostMapping("/addZone")
    public Result addZone(@RequestBody ZoneAddVo zoneAddVo){
        return zoneService.addZone(zoneAddVo);
    }
}
